/*
 * @Author: your name
 * @Date: 2020-11-04 14:53:34
 * @LastEditTime: 2021-05-31 17:25:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \ws-shop\src\router\routes.js
 */
import Home from '@/views/Home'
import WsFooter from '@/components/WsFooter'
const Mall = () => import('@/views/Mall')
const WsCategory = () => import('@/components/WsCategory')
const Cart = () => import('@/views/Cart')
const Mine = () => import('@/views/Mine')
const Detail = () => import('@/views/Detail')
const Login = () => import('@/views/Login')
const Register = () => import('@/views/Register')
const About = () => import('@/views/About')
const Feedback = () => import('@/views/Feedback')
const Locations = () => import('@/views/Locations')
const Question = () => import('@/views/Question')
const Ent = () => import('@/views/Ent')
const Collection = () => import('@/views/Collection')
const Details = () => import('@/views/Details')

const routes = [
  {
    path: '/',
    redirect: '/home',
    // meta元信息，不属于路由本身的信息
    meta: {
      isTabbar: false,
      isBackShow: false,
      title: '首页'
    }
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home, // router-view默认的
      'ws-footer': WsFooter // name为ws-footer
    },
    meta: {
      isTabbar: true,
      title: '首页',
      icon: 'home-o',
      isBackShow: false
    }
  },
  {
    path: '/mall',
    name: 'Mall',
    components: {
      default: Mall,
      'ws-footer': WsFooter
    },
    meta: {
      isTabbar: true,
      title: '商城',
      icon: 'shop-o',
      isBackShow: false
    },
    children: [
      {
        path: ':id',
        component: WsCategory,
        meta: {
          title: '商城',
          isBackShow: false
        }
      }
    ]
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default: Cart,
      'ws-footer': WsFooter
    },
    meta: {
      isTabbar: true,
      title: '购物车',
      icon: 'shopping-cart-o',
      isBackShow: false,
      isLogin: true
    }
  },
  {
    path: '/mine',
    name: 'Mine',
    components: {
      default: Mine,
      'ws-footer': WsFooter
    },
    meta: {
      isTabbar: true,
      title: '我的',
      icon: 'friends-o',
      isBackShow: false
    }
  },
  {
    path: '/detail',
    name: 'Detail',
    component: Detail,
    meta: {
      title: '详情',
      isTabbar: false,
      isBackShow: true
    }
  },
  {
    path: '/login',
    name: 'Login',
    components: {
      default: Login
    },
    meta: {
      title: '登录',
      isBackShow: true,
      isTabbar: false
    }
  },
  {
    path: '/register',
    name: 'Register',
    components: {
      default: Register
    },
    meta: {
      title: '注册',
      isBackShow: true,
      isTabbar: false
    }
  },
  {
    path: '/about',
    name: 'About',
    components: {
      default: About,
      'ws-footer': WsFooter
    },
    meta: {
      title: '关于我们',
      isBackShow: true,
      isTabbar: false
    }
  },
  {
    path: '/feedback',
    name: 'Feedback',
    components: {
      default: Feedback,
      'ws-footer': WsFooter
    },
    meta: {
      title: '意见反馈',
      isBackShow: true,
      isTabbar: false,
      isLogin: true
    }
  },
  {
    path: '/locations',
    name: 'Locations',
    components: {
      default: Locations,
      'ws-footer': WsFooter
    },
    meta: {
      title: '收货地址',
      isBackShow: true,
      isTabbar: false,
      isLogin: true
    }
  },
  {
    path: '/question',
    name: 'Question',
    components: {
      default: Question,
      'ws-footer': WsFooter
    },
    meta: {
      title: '服务中心',
      isBackShow: true,
      isTabbar: false
    }
  },
  {
    path: '/ent',
    name: 'Ent',
    components: {
      default: Ent,
      'ws-footer': WsFooter
    },
    meta: {
      title: '购物订单',
      isBackShow: true,
      isTabbar: false,
      isLogin: true
    }
  },
  {
    path: '/collection',
    name: 'Collection',
    components: {
      default: Collection,
      'ws-footer': WsFooter
    },
    meta: {
      title: '收藏',
      isBackShow: true,
      isTabbar: false,
      isLogin: true
    }
  },
  {
    path: '/details',
    name: 'Details',
    component: Details,
    meta: {
      title: '详情',
      isTabbar: false,
      isBackShow: true
    }
  }
]

export default routes
